/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "tradeset_broker")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TradesetBroker.findAll", query = "SELECT t FROM TradesetBroker t"),
    @NamedQuery(name = "TradesetBroker.findByBrokerID", query = "SELECT t FROM TradesetBroker t WHERE t.brokerID = :brokerID"),
    @NamedQuery(name = "TradesetBroker.findByRegionID", query = "SELECT t FROM TradesetBroker t WHERE t.regionID = :regionID"),
    @NamedQuery(name = "TradesetBroker.findByType", query = "SELECT t FROM TradesetBroker t WHERE t.type = :type"),
    @NamedQuery(name = "TradesetBroker.findByMarketCodeIss", query = "SELECT t FROM TradesetBroker t WHERE t.marketCodeIss = :marketCodeIss"),
    @NamedQuery(name = "TradesetBroker.findByOwnUserID", query = "SELECT t FROM TradesetBroker t WHERE t.ownUserID = :ownUserID"),
    @NamedQuery(name = "TradesetBroker.findByAlterUserID", query = "SELECT t FROM TradesetBroker t WHERE t.alterUserID = :alterUserID"),
    @NamedQuery(name = "TradesetBroker.findByCreateTime", query = "SELECT t FROM TradesetBroker t WHERE t.createTime = :createTime"),
    @NamedQuery(name = "TradesetBroker.findByTimeStamp", query = "SELECT t FROM TradesetBroker t WHERE t.timeStamp = :timeStamp")})
public class TradesetBroker implements Serializable {
	public static byte[] EnCode(TradesetBroker msg) throws IOException {
		Codec<TradesetBroker> Lcode = ProtobufProxy.create(TradesetBroker.class);
		return Lcode.encode(msg);
	}
	public static TradesetBroker DeCode(byte[] data) throws IOException {
	Codec<TradesetBroker> Lcode = ProtobufProxy.create(TradesetBroker.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "BrokerID")
    @Protobuf
	private String brokerID;
    @Basic(optional = false)
    @Column(name = "RegionID")
    @Protobuf
	private String regionID;
    @Column(name = "Type")
    @Protobuf
	private String type;
    @Column(name = "MarketCodeIss")
    @Protobuf
	private String marketCodeIss;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public TradesetBroker() {
    }

    public TradesetBroker(String brokerID) {
        this.brokerID = brokerID;
    }

    public TradesetBroker(String brokerID, String regionID) {
        this.brokerID = brokerID;
        this.regionID = regionID;
    }

    public String getBrokerID() {
        return brokerID;
    }

    public void setBrokerID(String brokerID) {
        this.brokerID = brokerID;
    }

    public String getRegionID() {
        return regionID;
    }

    public void setRegionID(String regionID) {
        this.regionID = regionID;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMarketCodeIss() {
        return marketCodeIss;
    }

    public void setMarketCodeIss(String marketCodeIss) {
        this.marketCodeIss = marketCodeIss;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (brokerID != null ? brokerID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TradesetBroker)) {
            return false;
        }
        TradesetBroker other = (TradesetBroker) object;
        if ((this.brokerID == null && other.brokerID != null) || (this.brokerID != null && !this.brokerID.equals(other.brokerID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.TradesetBroker[ brokerID=" + brokerID + " ]";
    }
    
}
